package com.example.demo.service;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.example.demo.domain.Comment;
import com.example.demo.mapper.CommentMapper;

@Service
public class CommentServiceImpl implements CommentService{
	private final Logger logger = LoggerFactory.getLogger(this.getClass());
	@Autowired
	CommentMapper commentMapper;
	
	@Override
	public int addComment(Comment comment) {
		logger.info("----CommentServiceImpl: addComment()");
		logger.info("----"+comment.toString());
		return commentMapper.insertComment(comment);
	}

	@Override
	public List<Comment> getCommentsOfArticleByAid(Long aid) {
		logger.info("----CommentServiceImpl: getCommentsOfArticleByAid()");
		return commentMapper.selectAllcommentsByAid(aid);
	}

}
